Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to dock player to top or bottom of page #331

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

wadebekker
Copy link

Description of the Change

This PR adds the ability to dock the player to the top or bottom of the page, in addition to the original 'inline' option.
When docked, the podcast details are hidden initially to save height. A 'More/Less' button is available to hide or reveal the podcast details.

Please note: This feature is still a WIP
Further styling is still required on the 'More/Less' button and layout, and general spacing needs to be reviewed and tested.
This feature is not yet fully tested in all major browsers and viewport sizes.

Closes #299

How to test the Change

  • Checkout PR branch
  • Run the project using Local
  • Open the website and log into the WP Admin Dashboard

From within the WP Admin Dashboard:

  • Create a Podcast.
  • Add a Podcast Block to a new or existing post.
  • Insert your podcast episode into the Podcast Block.
  • Inside the block editor panel, under 'Podcast Settings', a new set of controls labeled 'Dock Player' is available.
  • Toggle between 'Top', 'Bottom', 'None' to test the various docking options.
  • Toggle on a few of the 'Podcast Settings' options to test the 'More/Less' functionality.
  • Save/Publish your post to test the frontend output (outside of the WP admin area).

Changelog Entry

Added - New feature

Credits

@wadebekker

Checklist:

Desired results:

The designs below illustrate our goals for both mobile and desktop views. Note: When docked at the top, the player should remain visually identical but fixed to the top of the page.

desktop
mobile

@wadebekker wadebekker requested a review from a team as a code owner January 3, 2025 08:56
@wadebekker wadebekker requested review from peterwilsoncc and removed request for a team January 3, 2025 08:56
@github-actions github-actions bot added this to the Future Release milestone Jan 3, 2025
@github-actions github-actions bot added the needs:code-review This requires code review. label Jan 3, 2025
@jeffpaul jeffpaul modified the milestones: Future Release, 2.0.0 Jan 3, 2025
@jeffpaul
Copy link
Member

@peterwilsoncc over to you for review/testing, thanks!

Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a few notes inline to start with.

I think the expanding and contracting of details will need an aria-expanded and family for accessibility reasons.

I noticed in the dashboard when editing a post that a docked player is hidden behind the admin bar and post settings panels.

editor-view

When the blocks are shown on the index pages of a blog/category, it's possible to dock the items from each post which can look odd, and will be problematic if there all docked to the same location.

I think it will either need to be limited so only the first episode is docked on listing pages, or docking only works on single posts.

Screenshot 2025-01-21 at 1 12 40 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new code in this file uses tabs for intending, whereas the existing code is using spaces. Are you able to switch to spaces for consistency.

Comment on lines +196 to +197
// displayEpisodeTitle ||
// displayArt ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the commented out code.

Suggested change
// displayEpisodeTitle ||
// displayArt ||

Comment on lines +212 to +213
// displayEpisodeTitle,
// displayArt,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// displayEpisodeTitle,
// displayArt,

?>
<div class="wp-block-podcasting-podcast-outer">

<div class="wp-block-podcasting-podcast-outer <?php echo 'docked-' . esc_attr( $attributes['isDocked'] ); ?>">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick.

Suggested change
<div class="wp-block-podcasting-podcast-outer <?php echo 'docked-' . esc_attr( $attributes['isDocked'] ); ?>">
<div class="wp-block-podcasting-podcast-outer <?php echo 'docked-' . sanitize_html_class( $attributes['isDocked'] ); ?>">

<?php echo esc_html( $explicit ); ?>
</span>
<?php endif; ?>
<div id="podcast-details" style="display: none;">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IDs will need to be unique (use wp_unique_prefixed_id( 'podcast-details' )) to avoid duplicate IDs on index pages that contain multiple blocks.
Screenshot 2025-01-21 at 1 07 08 PM

// If isDocked is 'none', show details by default
<?php if ( $attributes['isDocked'] === 'none' ) : ?>
detailsDiv.style.display = 'block';
toggleButton.textContent = 'Less';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
toggleButton.textContent = 'Less';
toggleButton.textContent = <?php echo wp_json_encode( __( 'Less' ) ); ?>;

toggleButton.addEventListener('click', function() {
if (detailsDiv.style.display === 'none') {
detailsDiv.style.display = 'block';
toggleButton.textContent = 'Less';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

toggleButton.textContent = 'Less';
} else {
detailsDiv.style.display = 'none';
toggleButton.textContent = 'More';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

</div>
<div class="wp-block-podcasting-podcast__toggle-details">
<button id="toggle-details-button">More</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above re unique ID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Player enhancements - Ability to have the player docked to header or footer location on site.
3 participants